home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3435 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  704 b 

  1. Path: airdmhor.gen.nz!not-for-mail
  2. From: gumboot@airdmhor.gen.nz (Simon Hosie)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: division problem
  5. Date: 29 Jan 1996 12:50:30 +1300
  6. Organization: Airdmhor
  7. Distribution: world
  8. Message-ID: <4eh246$u6h@airdmhor.gen.nz>
  9. References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca>
  10. NNTP-Posting-Host: localhost.gen.nz
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. P.Bennett:
  14. > In order to make it work, you could do:
  15. >     celsius = (int)((5.0/9.0) * (fahrenheit - 32))
  16. > The 5.0/9.0 give a meaningful result, and force the multiplication to be done
  17. > with floats. The (int) will convert the result back to an int.
  18.  
  19.   That's disgusting!
  20.  
  21. celcius = (fahrenheit - 32) * 5 / 9;
  22.